package bhbt.service;


import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import bhbt.model.Daili;
import bhbt.model.DailiSheng;
import bhbt.model.Member;
import bhbt.model.ParamWage;
import bhbt.service.core.BaseService;






@Service
public class DailiShengService extends BaseService {
	
	@Resource 
	private DailiShengService dailiShengService;
	@Resource 
	private MemberService memberService;
	@Resource 
	private ParamWageService paramWageService;
	
	public void saveSheng(Member member,Daili newDaili){
		
		//代理升级日志
		Integer oldDaili=member.getDailiId();				//旧级别
		
		DailiSheng sheng=new DailiSheng();
		sheng.setUseType(10);
		sheng.setOldDailiId(oldDaili);
		sheng.setNewDailiId(newDaili.getId());
		sheng.setMemberId(member.getId());
		sheng.setCommitDate(new Date());
		this.dailiShengService.saveOrUpdate(sheng);
		
		
		//新的级别
		Map<String, Object> mapMember = new HashMap<String, Object>();
		mapMember.put("id", member.getId());
		mapMember.put("dailiId", newDaili.getId());
		 
		this.memberService.update(mapMember);
	 
		
	}  
	 

}
